home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Reference Guide
/
C-C++ Interactive Reference Guide.iso
/
c_ref
/
csource5
/
357_01
/
cstar1.exe
/
ENUM.H
< prev
next >
Wrap
Text File
|
1991-06-18
|
22KB
|
985 lines
/*
C* -- Header file for all enumerations.
source: enum.h
started: June 20, 1986
version: March 4, 1987
PUBLIC DOMAIN SOFTWARE
The CSTAR program was placed in the public domain on June 15, 1991,
by its author and sole owner,
Edward K. Ream
1617 Monroe Street
Madison, WI 53711
(608) 257-0802
CSTAR may be used for any commercial or non-commercial purpose.
See cstar.h or cstar.c for a DISCLAIMER OF WARRANTIES.
*/
/*
---------- PARSING ----------
*/
/*
Define constants used by the parser.
*/
/* #enum(0, ANY_EXPR, ASSIGN_EXPR, CONST_EXPR, XARITH_EXPR, ARG_EXPR) */
#define ANY_EXPR 0
#define ASSIGN_EXPR 1
#define CONST_EXPR 2
#define XARITH_EXPR 3
#define ARG_EXPR 4
/*
Enumerate storage classes for st_nodes.
The storage class is attached directly to the
symbol table node.
Storage class has nothing to do with type, and very
little to do with scope, although not all classes are
permitted in all scopes.
*/
/* #enum(0, NULL_CLASS,\
FORMAL_CLASS, FORMREG_CLASS, AUTO_CLASS, REGISTER_CLASS, GLOBAL_CLASS,\
EXTERN_CLASS, STATICG_CLASS, STATICL_CLASS, TYPEDEF_CLASS, TAG_CLASS,\
CODE_CLASS, SUE_CLASS, SCODE_CLASS) */
#define NULL_CLASS 0
#define FORMAL_CLASS 1
#define FORMREG_CLASS 2
#define AUTO_CLASS 3
#define REGISTER_CLASS 4
#define GLOBAL_CLASS 5
#define EXTERN_CLASS 6
#define STATICG_CLASS 7
#define STATICL_CLASS 8
#define TYPEDEF_CLASS 9
#define TAG_CLASS 10
#define CODE_CLASS 11
#define SUE_CLASS 12
#define SCODE_CLASS 13
#define is_rstack(class) (class > NULL_CLASS && class <= REGISTER_CLASS)
/*
Define principal type tokens. these are the header type, except for
adjectival modifiers (long, short, signed, unsigned, volatile, const)
DELEMENT and CAST are dummy types which allow overloading of the type
node for use as the spine of a declaration list, and for use in restricting
the parser within casts, respectively.
*/
/* #enum(0, NULL_TYPE,\
BOOL_TYPE, INT_TYPE, FLOAT_TYPE,\
VOID_TYPE, POINTER_TYPE, STRUCT_TYPE, UNION_TYPE, DECL_TYPE,\
ARRAY_TYPE, FUNCTION_TYPE, UELEMENT_TYPE, SELEMENT_TYPE, DELEMENT_TYPE,\
CAST_TYPE) */
#define NULL_TYPE 0
#define BOOL_TYPE 1
#define INT_TYPE 2
#define FLOAT_TYPE 3
#define VOID_TYPE 4
#define POINTER_TYPE 5
#define STRUCT_TYPE 6
#define UNION_TYPE 7
#define DECL_TYPE 8
#define ARRAY_TYPE 9
#define FUNCTION_TYPE 10
#define UELEMENT_TYPE 11
#define SELEMENT_TYPE 12
#define DELEMENT_TYPE 13
#define CAST_TYPE 14
#define is_element(x) (x >= UELEMENT_TYPE && x <= DELEMENT_TYPE)
/*
Define modifier and miscellaneous bits.
Explicit_mod indicates that the type node resulted from a keyword.
*/
/* #enum(0, NULL_MOD,\
CHAR_MOD = 0x01,\
SHORT_MOD = 0x02,\
LONG_MOD = 0x04,\
UNSIGNED_MOD = 0x08,\
SIZE_MODS = 0x07,\
ARITH_MODS = 0x0f,\
\
CONST_MOD = 0x100,\
VOLATILE_MOD = 0x200,\
SC_MODS = 0xf00) */
#define NULL_MOD 0
#define CHAR_MOD 0x01
#define SHORT_MOD 0x02
#define LONG_MOD 0x04
#define UNSIGNED_MOD 0x08
#define SIZE_MODS 0x07
#define ARITH_MODS 0x0f
#define CONST_MOD 0x100
#define VOLATILE_MOD 0x200
#define SC_MODS 0xf00
/* #enum (0, NULL_DEC, IBSSZB_DEC, ISTRA_DEC, ISTRS_DEC, ITAG_DEC) */
#define NULL_DEC 0
#define IBSSZB_DEC 1
#define ISTRA_DEC 2
#define ISTRS_DEC 3
#define ITAG_DEC 4
/* items for st_misc */
#define EXPLICIT_SYM 0x1000
#define ST_REG 63
/*
Enumerate the possible values of the "current scope"
*/
/* #enum(0, NULL_SCOPE, FILE_SCOPE, FNDEF_SCOPE, BLOCK_SCOPE, PROTO_SCOPE) */
#define NULL_SCOPE 0
#define FILE_SCOPE 1
#define FNDEF_SCOPE 2
#define BLOCK_SCOPE 3
#define PROTO_SCOPE 4
/*
Input Codes and Internal Operator Codes:
Type fields of parse nodes.
*/
/* #enum(0,\
NULL_TOK,\
\
K_AUTO, K_CHAR, K_CONST, K_DOUBLE, K_EXTERN,\
K_FLOAT, K_INT, K_LONG, K_REGISTER, K_SHORT,\
K_STATIC, K_TYPEDEF, K_SIGNED, K_STRUCT, K_UNION,\
K_UNSIGNED, K_VOID, K_VOLATILE,\
\
K_BREAK, K_CASE,\
K_CONTINUE, K_DEFAULT, K_DO, K_ELSE, K_FOR,\
K_GOTO, K_IF, K_RETURN, K_SWITCH, K_WHILE,\
\
K_ENTRY, K_ENUM, K_SIZEOF,\
\
SEPARATOR_TOK, NL_TOK,\
SEMICOLON_TOK, LBRACK_TOK, LCURLY_TOK, LPAREN_TOK, RBRACK_TOK,\
RCURLY_TOK, RPAREN_TOK,\
\
COLON_TOK, QUESTION_TOK,\
\
ARRAY_TOK, ARROW_TOK,\
DOT_TOK, LAND_TOK, LOR_TOK, COMMA_TOK,\
\
ASSN_TOK,\
AND_ASSN_TOK, DIV_ASSN_TOK, LSHIFT_ASSN_TOK, MINUS_ASSN_TOK, MOD_ASSN_TOK,\
OR_ASSN_TOK, PLUS_ASSN_TOK, RSHIFT_ASSN_TOK, STAR_ASSN_TOK, XOR_ASSN_TOK,\
\
AND_TOK, OR_TOK, PLUS_TOK, STAR_TOK, XOR_TOK,\
\
DIV_TOK, LSHIFT_TOK, MINUS_TOK, MOD_TOK, RSHIFT_TOK,\
\
EQUAL_TOK, GE_TOK, GT_TOK, LE_TOK, LT_TOK,\
NE_TOK,\
\
DEC_TOK, INC_TOK, NOT_TOK, TILDE_TOK,\
\
CAST_TOK,\
POST_DEC_TOK, POST_INC_TOK, PRE_DEC_TOK, PRE_INC_TOK,\
\
UAND_TOK, UMINUS_TOK, UPLUS_TOK, USTAR_TOK,\
\
CALL_TOK,\
\
AREG_TOK,\
CC_TOK, CHAR_TOK, DREG_TOK, EOF_TOK, EOP_TOK,\
GREG_TOK, ID_TOK, INT_TOK, LONG_TOK, Z_TOK,\
STRING_TOK, X_TOK,\
\
BOOL_TOK,\
LABEL_TOK) */
/*
Input Codes and Internal Operator Codes:
Type fields of parse nodes.
*/
#define NULL_TOK 0
/* start of key subenum. */
/* kdecl subenum. */
#define K_AUTO 1
#define K_CHAR 2
#define K_CONST 3
#define K_DOUBLE 4
#define K_EXTERN 5
#define K_FLOAT 6
#define K_INT 7
#define K_LONG 8
#define K_REGISTER 9
#define K_SHORT 10
#define K_STATIC 11
#define K_TYPEDEF 12
#define K_SIGNED 13
#define K_STRUCT 14
#define K_UNION 15
#define K_UNSIGNED 16
#define K_VOID 17
#define K_VOLATILE 18
/* kcontrol subenum. */
#define K_BREAK 19
#define K_CASE 20
#define K_CONTINUE 21
#define K_DEFAULT 22
#define K_DO 23
#define K_ELSE 24
#define K_FOR 25
#define K_GOTO 26
#define K_IF 27
#define K_RETURN 28
#define K_SWITCH 29
#define K_WHILE 30
/* Remainder of key subenum. */
#define K_ENTRY 31
#define K_ENUM 32
#define K_SIZEOF 33
/* Separator and grouping tokens. */
/* Start of is_op subenum. */
#define SEPARATOR_TOK 34
#define NL_TOK 35
#define SEMICOLON_TOK 36
#define LBRACK_TOK 37
#define LCURLY_TOK 38
#define LPAREN_TOK 39
#define RBRACK_TOK 40
#define RCURLY_TOK 41
#define RPAREN_TOK 42
/* is_ternop. */
#define COLON_TOK 43
#define QUESTION_TOK 44
/* Start of is_binop enum. */
#define ARRAY_TOK 45
#define ARROW_TOK 46
#define DOT_TOK 47
#define LAND_TOK 48
#define LOR_TOK 49
#define COMMA_TOK 50
/* is_assnop subenum. */
#define ASSN_TOK 51
#define AND_ASSN_TOK 52
#define DIV_ASSN_TOK 53
#define LSHIFT_ASSN_TOK 54
#define MINUS_ASSN_TOK 55
#define MOD_ASSN_TOK 56
#define OR_ASSN_TOK 57
#define PLUS_ASSN_TOK 58
#define RSHIFT_ASSN_TOK 59
#define STAR_ASSN_TOK 60
#define XOR_ASSN_TOK 61
/* is_aop, is_abelian subenum. */
#define AND_TOK 62
#define OR_TOK 63
#define PLUS_TOK 64
#define STAR_TOK 65
#define XOR_TOK 66
#define DIV_TOK 67
#define LSHIFT_TOK 68
#define MINUS_TOK 69
#define MOD_TOK 70
#define RSHIFT_TOK 71
/* end of is_aop. */
/* is_relop subenum. */
/* Final entries of is_binop subenum. */
#define EQUAL_TOK 72
#define GE_TOK 73
#define GT_TOK 74
#define LE_TOK 75
#define LT_TOK 76
#define NE_TOK 77
/* Unary operators returned by get_token(). */
#define DEC_TOK 78
#define INC_TOK 79
#define NOT_TOK 80
#define TILDE_TOK 81
/* Unary operators created by expr(). */
/* is_unop subenum. */
#define CAST_TOK 82
#define POST_DEC_TOK 83
#define POST_INC_TOK 84
#define PRE_DEC_TOK 85
#define PRE_INC_TOK 86
/* Artificial unary operators; also is_unop */
#define UAND_TOK 87
#define UMINUS_TOK 88
#define UPLUS_TOK 89
#define USTAR_TOK 90
/* Operators with variable operand count */
/* Final entries in is_op subenum. */
#define CALL_TOK 91
/* Class tokens. */
#define AREG_TOK 92
#define CC_TOK 93
#define CHAR_TOK 94
#define DREG_TOK 95
#define EOF_TOK 96
#define EOP_TOK 97
#define GREG_TOK 98
#define ID_TOK 99
#define INT_TOK 100
#define LONG_TOK 101
#define Z_TOK 102
#define STRING_TOK 103
#define X_TOK 104
/* Miscellaneous internal tokens */
#define BOOL_TOK 105
#define LABEL_TOK 106
/*
Most of the unary operators are specials generated in the parser.
Only NOT_TOK and TILDE_TOK are unambiguously unary.
*/
#define is_kdecl(n) (n >= K_AUTO && n <= K_VOLATILE)
#define is_kcontrol(n) (n >= K_BREAK && n <= K_WHILE)
#define is_key(n) (n >= K_AUTO && n <= K_SIZEOF)
#define is_op(n) (n >= SEPARATOR_TOK && n <= CALL_TOK)
#define is_binop(n) (n >= ARRAY_TOK && n <= NE_TOK)
#define is_assnop(n) (n >= ASSN_TOK && n <= XOR_ASSN_TOK)
#define is_abelian(n) (n >= AND_TOK && n <= XOR_TOK)
#define is_aop(n) (n >= AND_TOK && n <= RSHIFT_TOK)
#define is_relop(n) (n >= EQUAL_TOK && n <= NE_TOK)
#define is_unop(n) (n >= NOT_TOK && n <= USTAR_TOK)
#define is_argop(n) (n >= COLON_TOK && n <= CALL_TOK)
/*
---------- CODE GENERATION ----------
*/
/*
Define optimizer flags n_oflags
*/
#define OPT_NONEED 1
#define OPT_ZNEED 2
#define OPT_ZFLAG 4
/*
Segments
*/
/* #enum(0,S_BSS, S_DATA, S_TEXT) */
#define S_BSS 0
#define S_DATA 1
#define S_TEXT 2
/*
Output op codes: type codes in code/loc nodes.
CAUTION: this sequence is keyed to a print table in glb.c and
to an existence table in t2.s; these tables constitute implicit
references to the enumeration, which will not show up by doing
a find. Alterations in this enumeration
must be matched with suitable changes in those tables.
WARNING: the items X_BXX, X_DBXX, and X_SXX need to be removed;
they imply the existence of subtypes, and since X_TOK's are
passed as integers, there's no way to pass the implied subtypes.
X_MODS and X_MODU are not really needed, and ought to be removed.
The code generator does not use them, and the divide instruction
is so peculiar that a programmer ought to write it out.
Prior to doing any removals, use the find command to make sure
explicit references have been removed.
*/
/* #enum(1,\
\
X_ABCD, X_ADD, X_ADDA, X_ADDI, X_ADDQ,\
X_ADDX, X_AND, X_ANDI, X_ASL, X_ASR,\
X_BCHG, X_BCLR, X_BRA, X_BSET, X_BSR,\
X_BTST, X_BXX, X_CHK, X_CLR, X_CMP,\
X_CMPA, X_CMPI, X_CMPM, X_DBXX, X_DIVS,\
X_DIVU, X_EOR, X_EORI, X_EXG, X_EXT,\
X_JMP, X_JSR, X_LEA, X_LINK, X_LSL,\
X_LSR, X_MOVE, X_MOVEA,X_MOVEM,X_MOVEP,\
X_MOVEQ,X_MULS, X_MULU, X_NBCD, X_NEG,\
X_NEGX, X_NOP, X_NOT, X_OR, X_ORI,\
X_PEA, X_RESET, X_ROL, X_ROR, X_ROXL,\
X_ROXR, X_RTE, X_RTR, X_RTS, X_SBCD,\
X_SXX, X_STOP, X_SUB, X_SUBA, X_SUBI,\
X_SUBQ, X_SUBX, X_SWAP, X_TAS, X_TRAP,\
X_TRAPV, X_TST, X_UNLK,\
\
X_MODS, X_MODU,\
\
X_BCC, X_BCS, X_BEQ, X_BGE, X_BGT, X_BHI, X_BLE,\
X_BLS, X_BLT, X_BMI, X_BNE, X_BPL, X_BVC, X_BVS,\
\
X_DBCC, X_DBCS, X_DBEQ, X_DBF , X_DBGE, X_DBGT, X_DBHI, X_DBLE,\
X_DBLS, X_DBLT, X_DBMI, X_DBNE, X_DBPL, X_DBT , X_DBVC, X_DBVS,\
\
X_SCC, X_SCS, X_SEQ, X_SF , X_SGE, X_SGT, X_SHI, X_SLE,\
X_SLS, X_SLT, X_SMI, X_SNE, X_SPL, X_ST , X_SVC, X_SVS,\
\
Z_ADDSP, Z_ADJSP, Z_BASE, Z_BSS, Z_DATA,\
Z_DC, Z_DCB, Z_DCL, Z_DCW, Z_DS, Z_DSB, Z_DSL, Z_DSW,\
Z_NOBASE, Z_ORG, Z_POP, Z_PUSH, Z_SUBSP, Z_TEXT,\
\
O_LABEL, O_ULABEL, O_LITERAL, O_LOCATION, O_LINENUM,\
\
Q_BRN) */
/* Machine instructions. */
/* Input code = X_TOK. */
/* Start of the is_otok subenum. */
/* Start of the is_xtok subenum. */
#define X_ABCD 1
#define X_ADD 2
#define X_ADDA 3
#define X_ADDI 4
#define X_ADDQ 5
#define X_ADDX 6
#define X_AND 7
#define X_ANDI 8
#define X_ASL 9
#define X_ASR 10
#define X_BCHG 11
#define X_BCLR 12
#define X_BRA 13
#define X_BSET 14
#define X_BSR 15
#define X_BTST 16
#define X_BXX 17
#define X_CHK 18
#define X_CLR 19
#define X_CMP 20
#define X_CMPA 21
#define X_CMPI 22
#define X_CMPM 23
#define X_DBXX 24
#define X_DIVS 25
#define X_DIVU 26
#define X_EOR 27
#define X_EORI 28
#define X_EXG 29
#define X_EXT 30
#define X_JMP 31
#define X_JSR 32
#define X_LEA 33
#define X_LINK 34
#define X_LSL 35
#define X_LSR 36
#define X_MOVE 37
#define X_MOVEA 38
#define X_MOVEM 39
#define X_MOVEP 40
#define X_MOVEQ 41
#define X_MULS 42
#define X_MULU 43
#define X_NBCD 44
#define X_NEG 45
#define X_NEGX 46
#define X_NOP 47
#define X_NOT 48
#define X_OR 49
#define X_ORI 50
#define X_PEA 51
#define X_RESET 52
#define X_ROL 53
#define X_ROR 54
#define X_ROXL 55
#define X_ROXR 56
#define X_RTE 57
#define X_RTR 58
#define X_RTS 59
#define X_SBCD 60
#define X_SXX 61
#define X_STOP 62
#define X_SUB 63
#define X_SUBA 64
#define X_SUBI 65
#define X_SUBQ 66
#define X_SUBX 67
#define X_SWAP 68
#define X_TAS 69
#define X_TRAP 70
#define X_TRAPV 71
#define X_TST 72
#define X_UNLK 73
/* NOTE: These are not real machine ops. */
#define X_MODS 74
#define X_MODU 75
/* Variations of the Bxx instruction. */
/* is_bxx subenum. */
#define X_BCC 76
#define X_BCS 77
#define X_BEQ 78
#define X_BGE 79
#define X_BGT 80
#define X_BHI 81
#define X_BLE 82
#define X_BLS 83
#define X_BLT 84
#define X_BMI 85
#define X_BNE 86
#define X_BPL 87
#define X_BVC 88
#define X_BVS 89
/* Variations of the DBxx instruction. */
/* is_dbxx subenum. */
#define X_DBCC 90
#define X_DBCS 91
#define X_DBEQ 92
#define X_DBF 93
#define X_DBGE 94
#define X_DBGT 95
#define X_DBHI 96
#define X_DBLE 97
#define X_DBLS 98
#define X_DBLT 99
#define X_DBMI 100
#define X_DBNE 101
#define X_DBPL 102
#define X_DBT 103
#define X_DBVC 104
#define X_DBVS 105
/* Variations of the Sxx instruction. */
/* Final part of the is_xtok subenum. */
#define X_SCC 106
#define X_SCS 107
#define X_SEQ 108
#define X_SF 109
#define X_SGE 110
#define X_SGT 111
#define X_SHI 112
#define X_SLE 113
#define X_SLS 114
#define X_SLT 115
#define X_SMI 116
#define X_SNE 117
#define X_SPL 118
#define X_ST 119
#define X_SVC 120
#define X_SVS 121
/* Pseudo instructions. */
/* Input code = PSEUDO_TOK. */
/* is_ztok subenum. */
#define Z_ADDSP 122
#define Z_ADJSP 123
#define Z_BASE 124
#define Z_BSS 125
#define Z_DATA 126
#define Z_DC 127
#define Z_DCB 128
#define Z_DCL 129
#define Z_DCW 130
#define Z_DS 131
#define Z_DSB 132
#define Z_DSL 133
#define Z_DSW 134
#define Z_NOBASE 135
#define Z_ORG 136
#define Z_POP 137
#define Z_PUSH 138
#define Z_SUBSP 139
#define Z_TEXT 140
/* Other code nodes. */
/* Final part of the is_otok subenum. */
#define O_LABEL 141
#define O_ULABEL 142
#define O_LITERAL 143
#define O_LOCATION 144
#define O_LINENUM 145
/* Pseudo nodes for internal use; these generate no output */
#define Q_BRN 146
/* Define some common synonyms. */
/* DBRA means branch always; DBCS means branch UNTIL carry is set, i.e.
if the carry is unset! See pp. 115-116 in the Book */
#define X_BLO X_BCS
#define X_BHS X_BCC
#define X_DBRA X_DBF
#define X_DBRN X_DBT
#define X_DBLO X_DBCS
#define X_DBHS X_DBCC
#define X_SLO X_SCS
#define X_SHS X_SCC
#define is_xtok(n) (n >= X_ABCD && n <= X_SVS)
#define is_ztok(n) (n >= Z_ADDSP && n <= Z_TEXT)
#define is_otok(n) (n >= 1 && n <= O_LINENUM)
#define is_qtok(n) (n >= Q_BRN)
#define is_bxx(n) (n >= X_BCC && n <= X_BVS)
#define is_dbxx(n) (n >= X_DBCC && n <= X_DBVS)
/*
Variations on op codes.
Not used when assembly output is generated.
*/
#ifdef OBJECT_OUT
#define XC_ANDI X_ANDI /* and to ccr */
#define XS_ANDI X_ANDI /* and to ssr */
#define XM_ASL X_ASL /* asl to mem */
#define XR_ASL X_ASL /* asl to reg */
#define XM_ASR X_ASR /* asr to mem */
#define XR_ASR X_ASR /* asr to reg */
#define XD_BCHG X_BCHG /* dynamic bchg */
#define XS_BCHG X_BCHG /* static bchg */
#define XD_BCLR X_BCLR /* dynamic bclr */
#define XS_BCLR X_BCLR /* static bclr */
#define XD_BSET X_BSET /* dynamic bset */
#define XS_BSET X_BSET /* static bset */
#define XD_BTST X_BTST /* dynamic btst */
#define XS_BTST X_BTST /* static btst */
#define XC_EORI X_EORI /* eori to ccr */
#define XS_EORI X_EORI /* eori to ssr */
#define XA_EXG X_EXG /* exg An,An */
#define XD_EXG X_EXG /* exg Dn,Dn */
#define XM1_EXG X_EXG /* exg An,Dn */
#define XM2_EXG X_EXG /* exg Dn,An */
#define XM_LSL X_LSL /* lsl to mem */
#define XR_LSL X_LSL /* lsl to reg */
#define XM_LSR X_LSR /* lsr to mem */
#define XR_LSR X_LSR /* lsr to mem */
#define XC_MOV X_MOVE /* move ccr */
#define X2C_MOV X_MOVE /* move to ccr */
#define XS_MOV X_MOVE /* move ssr */
#define X2S_MOV X_MOVE /* move to ssr */
#define XR2M_MOVM X_MOVEM /* movem reglist,ae */
#define XM2R_MOVM X_MOVEM /* movem ae,reglist */
#define XC_ORI X_ORI /* ori to ccr */
#define XS_ORI X_ORI /* ori to ssr */
#define XM_ROL X_ROL /* rol to mem */
#define XR_ROL X_ROL /* rol to reg */
#define XM_ROR X_ROR /* ror to mem */
#define XR_ROR X_ROR /* ror to reg */
#define XM_ROXL X_ROXL /* roxl to mem */
#define XR_ROXL X_ROXL /* roxl to reg */
#define XM_ROXR X_ROXR /* roxr to mem */
#define XR_ROXR X_ROXR /* roxr to reg */
#endif /* OBJECT_OUT */
/*
Output operand codes: type codes in loc_nodes.
*/
/* #enum(1,\
\
R_A0, R_A1, R_A2, R_A3, R_A4, R_A5, R_A6, R_A7,\
\
R_A0W, R_A1W, R_A2W, R_A3W, R_A4W, R_A5W, R_A6W, R_A7W,\
\
R_D0, R_D1, R_D2, R_D3, R_D4, R_D5, R_D6, R_D7,\
R_D0W, R_D1W, R_D2W, R_D3W, R_D4W, R_D5W, R_D6W, R_D7W,\
R_D0B, R_D1B, R_D2B, R_D3B, R_D4B, R_D5B, R_D6B, R_D7B,\
\
R_CCR, R_PC, R_SP, R_SPW, R_SR, R_USP,\
\
CC_CC, CC_CS, CC_EQ, CC_F, CC_GE, CC_GT, CC_HI, CC_LE,\
CC_LS, CC_LT, CC_MI, CC_NE, CC_PL, CC_T, CC_VC, CC_VS) */
/* Address regs. Input code AREG_TOK. */
/* R_A0 through R_A7 may be used in (an) mode. */
/* R_A0 through R_RDW are valid index registers. */
/* is_areg subenum. */
#define R_A0 1
#define R_A1 2
#define R_A2 3
#define R_A3 4
#define R_A4 5
#define R_A5 6
#define R_A6 7
#define R_A7 8
/* NOT part of is_areg subenum. */
#define R_A0W 9
#define R_A1W 10
#define R_A2W 11
#define R_A3W 12
#define R_A4W 13
#define R_A5W 14
#define R_A6W 15
#define R_A7W 16
/* Data regs. Input code DREG_TOK. */
/* is_dreg subenum. */
#define R_D0 17
#define R_D1 18
#define R_D2 19
#define R_D3 20
#define R_D4 21
#define R_D5 22
#define R_D6 23
#define R_D7 24
#define R_D0W 25
#define R_D1W 26
#define R_D2W 27
#define R_D3W 28
#define R_D4W 29
#define R_D5W 30
#define R_D6W 31
#define R_D7W 32
#define R_D0B 33
#define R_D1B 34
#define R_D2B 35
#define R_D3B 36
#define R_D4B 37
#define R_D5B 38
#define R_D6B 39
#define R_D7B 40
/* General regs. Input code GREG_TOK. */
/* is_greg subenum. */
#define R_CCR 41
#define R_PC 42
#define R_SP 43
#define R_SPW 44
#define R_SR 45
#define R_USP 46
/* Condition codes. Input code CC_TOK. */
/* is_cc subenum. */
#define CC_CC 47
#define CC_CS 48
#define CC_EQ 49
#define CC_F 50
#define CC_GE 51
#define CC_GT 52
#define CC_HI 53
#define CC_LE 54
#define CC_LS 55
#define CC_LT 56
#define CC_MI 57
#define CC_NE 58
#define CC_PL 59
#define CC_T 60
#define CC_VC 61
#define CC_VS 62
#define CC_LO CC_CS
#define is_areg(reg) (reg >= R_A0 && reg <= R_A7W)
#define is_aregw(reg) (reg >= R_A0W && reg <= R_A7W)
#define is_dreg(reg) (reg >= R_D0 && reg <= R_D7B)
#define is_xreg(reg) (reg >= R_A0 && reg <= R_D7B)
#define is_reg(reg) (reg >= R_A0 && reg <= R_SR)
#define is_apreg(reg) (is_areg(reg) || reg == R_PC)
#define is_greg(reg) (reg >= R_CCR && reg <= R_SR)
#define is_cc(reg) (reg >= CC_CC && reg <= CC_VS)
/* note use of xxx_rtb[] from glb.c */
#define reg_idx(reg) (reg_itb[reg])
#define d_reg(idx) (d_rtb[idx])
#define a_reg(idx) (a_rtb[idx])
#define real_reg(reg) (x_rtb[reg])
/*
Loc_nodes:
*/
/* Define values in n_mode field. */
/* #enum(0, VALUE_MODE, EA_MODE, EAPRD_MODE, EAPSI_MODE) */
#define VALUE_MODE 0
#define EA_MODE 1
#define EAPRD_MODE 2
#define EAPSI_MODE 3
/* VALUE_MODE is to be the default in fresh nodes */
#define is_ea(x) (x >= EA_MODE)
#define has_effect(x) (x >= EAPRD_MODE)
/* Define items in n_scflgs field */
/*
#enum(1, X2_WORD, X2_LONG, X2_WSCALE, X2_USCALE, X2_LSCALE, X2_OK, X2_ABSW)
*/
#define X2_WORD 1
#define X2_LONG 2
#define X2_WSCALE 3
#define X2_USCALE 4
#define X2_LSCALE 5
#define X2_OK 6
#define X2_ABSW 7
/*
---------- TABLES for INTERPRETERS ----------
*/
/*
Permissible-length fields, 1=length permissible
Second and third fields of the entry macro
*/
/* #enum(0,\
LEN8_AM=1, LEN16_AM=2, LEN32_AM=4,\
NOT8_AM=6, NOT16_AM=5, NOT32_AM=3, ANY_AM=7,\
AS_1_AM=8, MODE1_AM, MODE2_AM); */
#define LEN8_AM 1
#define LEN16_AM 2
#define LEN32_AM 4
#define NOT8_AM 6
#define NOT16_AM 5
#define NOT32_AM 3
#define ANY_AM 7
#define AS_1_AM 8
#define MODE1_AM 9
#define MODE2_AM 10
/*
Define addressing modes.
q8bit -128 through 127
quick8 1 through 8
bit31 0 through 31
trap15 0 through 15
Fourth and fifth fields of the entry macro.
*/
/* #enum(0,\
NONE_AM,\
GEN_AM=32, MEM_AM, ALT_AM, DALT_AM, MALT_AM, DATA_AM,\
INC_AM, DEC_AM, DISP_AM, CONTROL_AM, REGLIST_AM,\
MOVEM2R_AM, MOVER2M_AM, CCR_AM, SR_AM, AN_AM,\
DN_AM, D_AN_AM, IMM_AM, IMM8_AM, IMM16_AM, Q8BIT_AM,\
QUICK8_AM, BIT31_AM, TRAP15_AM, USP_AM) */
#define NONE_AM 0
#define GEN_AM 32
#define MEM_AM 33
#define ALT_AM 34
#define DALT_AM 35
#define MALT_AM 36
#define DATA_AM 37
#define INC_AM 38
#define DEC_AM 39
#define DISP_AM 40
#define CONTROL_AM 41
#define REGLIST_AM 42
#define MOVEM2R_AM 43
#define MOVER2M_AM 44
#define CCR_AM 45
#define SR_AM 46
#define AN_AM 47
#define DN_AM 48
#define D_AN_AM 49
#define IMM_AM 50
#define IMM8_AM 51
#define IMM16_AM 52
#define Q8BIT_AM 53
#define QUICK8_AM 54
#define BIT31_AM 55
#define TRAP15_AM 56
#define USP_AM 57
#define X_T_FRAME 6